home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / prodpack.zip / DB4PPSRC.EXE / _TALKMOD.PRG < prev    next >
Text File  |  1993-05-04  |  2KB  |  74 lines

  1. FUNCTION _TalkMode   && Set and Query TALK Setting
  2. PARAMETER p__action
  3. *--------------------------------------------------------------------
  4. * NAME
  5. *   _TalkMode - Set and query TALK Setting
  6. *
  7. * SYNOPSIS
  8. *   _TalkMode( p__action )
  9. *
  10. * DESCRIPTION
  11. *   TalkMode() sets the TALK mode ON or OFF
  12. *   based on pp_action.  The function returns a
  13. *   logical value representing the SET TALK mode prior
  14. *   to execution of the function.  If a non-logical
  15. *   value is used for pp_action, _TALKMODE() will
  16. *   return the current state of SET TALK ON or OFF
  17. *   without changing it.
  18. *
  19. * PARAMETER(S)
  20. *   p__action - If a logical value, .T. will SET TALK
  21. *   ON and .F. will SET TALK OFF.  The prior setting
  22. *   will be returned as a logical value.  An argument
  23. *   of any other data type will merely cause the
  24. *   current SET TALK setting to be returned.
  25. *
  26. * EXAMPLE
  27. *
  28. *   * Here _TALKMODE() is used to set TALK ON, and
  29. *   * then restore the original TALK setting:
  30. *
  31. *   * Set talk mode off:
  32. *   oldmode = _TALKMODE(.T.)
  33. *     ...  more code here ...
  34. *   * Return TALK to original setting:
  35. *   oldmode = _TALKMODE(oldmode)
  36. *
  37. *   * If you want to restore the talk mode in
  38. *   * a program and you don't need the previous
  39. *   * result, try the following:
  40. *   IF _TALKMODE( oldmode )
  41. *   ENDIF
  42. *
  43. *   * This toggles TALK mode to the opposite value:
  44. *   mdummy = _TALKMODE( .NOT. _TALKMODE(0) )
  45. *
  46. * SEE ALSO:
  47. *   SET TALK, SET("TALK")
  48. *
  49. *--------------------------------------------------------------------
  50.  
  51.   PRIVATE ll_oldmode
  52.  
  53.   IF SET("TALK") = "ON"
  54.     SET TALK OFF
  55.     ll_oldmode = .T.
  56.     SET TALK ON
  57.   ELSE
  58.     ll_oldmode = .F.
  59.   ENDIF
  60.  
  61.   IF TYPE( "p__action" ) = "L"
  62.  
  63.     IF p__action
  64.       SET TALK ON
  65.     ELSE
  66.       SET TALK OFF
  67.     ENDIF
  68.  
  69.   ENDIF
  70.  
  71. RETURN( ll_oldmode )
  72. *-- END: _TalkMode( p__action )
  73.  
  74.